1. /* slcmput.cpp by K.Tsuru */
  2. // function ID = 901
  3. /**************************
  4. SLComplex class
  5. It provides the output.
  6. **************************/
  7. #ifndef SN_H
  8. #include "sn.h"
  9. #endif
  10. long SLComplex::Put(bool crlf, int fmt) const {
  11. SLong abs_im;
  12. long p = 0;
  13. if(fmt == BracketFMT){
  14. re.FPutc('('); p++;
  15. p += re.Put();
  16. re.FPuts(", "); p += 2;
  17. p += im.Put();
  18. re.FPutc(')'); p++;
  19. if(crlf){ re.FPutc('\n'); p++; }
  20. return p;
  21. }
  22. int imSign = im.Sign(901);
  23. if(imSign < 0) abs_im = Dabs(im);
  24. if(crlf) p = re.Puts();
  25. else p = re.Put();
  26. if(imSign < 0){
  27. p += re.FPuts("-i*");
  28. p += abs_im.Put();
  29. } else if(imSign > 0){
  30. p += re.FPuts("+i*");
  31. p += im.Put();
  32. } else p += re.FPuts("+i*0.0");
  33. if(crlf){
  34. re.FPutc('\n'); p++;
  35. }
  36. return p;
  37. }

slcmput.cpp : last modifiled at 2015/11/17 15:45:58(801 bytes)
created at 2017/10/06 15:21:28
The creation time of this html file is 2017/10/06 15:27:09 (Fri Oct 06 15:27:09 2017).